var vib_viewer = viewer;
vib_viewer.setBackgroundColor(0xffffff);

function refresh(data,N) {
    vib_viewer.stopAnimate();
    vib_viewer.removeAllModels();
    vib_viewer.clear();
    vib_viewer.addModel(data, "xyz");
    vib_viewer.vibrate(N, 1, true, {});
    vib_viewer.animate({'loop': 'forward','reps':1});
    vib_viewer.setStyle({}, {stick:{}});
    vib_viewer.zoomTo();
    vib_viewer.render( );
}

var data = `14
Aniline
C -0.7937 1.1602 -0.0235 0.6834 -0.0064 0.0086
C -1.4336 -0.0793 -0.0360 -0.1263 -0.0441 -0.0018
C -0.6548 -1.2367 -0.0275 0.0514 -0.0172 0.0011
C 0.7232 -1.1522 -0.0035 -0.0425 -0.0322 -0.0008
C 1.3516 0.0820 0.0099 -0.0433 0.0785 -0.0006
C 0.5849 1.2353 0.0004 -0.3439 -0.0519 -0.0052
N -2.8120 -0.1593 0.0143 -0.0370 -0.0404 0.0009
H -1.3893 2.0624 -0.0312 -0.1187 0.1148 -0.0013
H -1.1422 -2.2017 -0.0383 -0.0012 0.0037 -0.0000
H 1.3119 -2.0583 0.0018 -0.0002 -0.0007 -0.0000
H 2.4291 0.1444 0.0264 -0.0010 0.0029 -0.0001
H 1.0650 2.2033 0.0088 -0.0163 -0.0035 -0.0003
H -3.3166 0.6603 -0.2825 0.0020 -0.0035 -0.0002
H -3.2186 -1.0306 -0.2854 -0.0063 -0.0001 -0.0002`;

refresh(data,40);

var data2 = `14
Aniline
C -0.7937 1.1602 -0.0235 -0.0322 -0.0163 -0.0008
C -1.4336 -0.0793 -0.0360 0.0212 0.0359 0.0003
C -0.6548 -1.2367 -0.0275 0.0228 -0.0944 0.0006
C 0.7232 -1.1522 -0.0035 -0.0061 0.6661 0.0018
C 1.3516 0.0820 0.0099 -0.1352 -0.2826 -0.0028
C 0.5849 1.2353 0.0004 0.0374 -0.0683 0.0006
N -2.8120 -0.1593 0.0143 0.0030 -0.0063 0.0002
H -1.3893 2.0624 -0.0312 -0.0006 0.0004 -0.0001
H -1.1422 -2.2017 -0.0383 -0.0280 -0.0042 -0.0006
H 1.3119 -2.0583 0.0018 0.1158 -0.2228 0.0009
H 2.4291 0.1444 0.0264 -0.0025 -0.0028 -0.0001
H 1.0650 2.2033 0.0088 0.0031 -0.0039 0.0000
H -3.3166 0.6603 -0.2825 0.0016 -0.0001 0.0002
H -3.2186 -1.0306 -0.2854 -0.0002 -0.0009 -0.0002`;

setTimeout(function() {
 refresh(data2,4); }, 1000);


